/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.webanovare.model;

import com.webanovare.model.db.News;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author daniel
 */
@Stateless
public class NewsRegistry  extends AbstractDAO<News, Long> {
    @PersistenceContext(unitName = "webanovare_pu")
    protected EntityManager em;
    
    public NewsRegistry() {
        super(News.class);
    }
    
    @PostConstruct
    public void postContruct(){
        Logger.getAnonymousLogger().log(Level.INFO, "Alive {0}", this);
        super.setEntitymanager(em);
    }
    
    public List<News> getInDescOrder() {
        return super.getAllOrderBy("date", false);
    }
}
